home *** CD-ROM | disk | FTP | other *** search
- ***************************************************
- * GEM menu demo *
- * *
- * Written by Devin Smith 11/15/86 *
- ***************************************************
-
- * GST assembler
-
- opt abs
- section one
-
- *-------------------------------------------------------------------------
- * program start - here we free up memory not used by the program
- *-------------------------------------------------------------------------
-
- freemem
- move.l 4(sp),A5 ;A5 now points to base page start, $100
- ;bytes below program start
- lea.l stack,A7 ;setup new stack
- move.l $C(A5),D0 ;put length of program area in D0
- add.l $14(A5),D0 ;add length of initialized data area
- add.l #ebss-sbss,D0 ;length of uninitialized data area; this
- ;is the bss section--it must be done this
- ;way 'cause of the lame GST assembler
- add.l #$100,D0 ;add $100 bytes for the base page
- ;D0 now contains all of the space this
- ;program uses or will uses plus $100
- ;bytes for the base page
-
- move.l D0,-(sp) ;push amount of space to be reserved
- move.l A5,-(sp) ;push start address of space
- clr.w -(sp) ;meaningless, but quite necessary word
- move.w #$4A,-(sp) ;code = SETBLOCK
- trap #1 ;GEMDOS
- lea.l 12(sp),sp ;fix sp
- tst.w D0 ;error?
- bne.s done ;yes = terminate program
-
- *-------------------------------------------------------------------------
- * here we execute the main program and set up routines that are used to
- * call AES and VDI funtions
- *-------------------------------------------------------------------------
-
- start
- bsr.s main
- done
- clr.w -(sp)
- trap #1 ;exit to OS
-
- aes
- move.l #aespb,D1 ;address of parameter block
- move.w #$C8,D0 ;opcode for AES
- trap #2
- rts
-
- vdi
- move.l #vdipb,D1 ;address of parameter block
- moveq.l #$73,D0 ;opcode for VDI
- trap #2
- rts
-
- *-------------------------------------------------------------------------
- * main program starts here
- *-------------------------------------------------------------------------
-
- main
- clr.l ap1resv
- clr.l ap2resv
- clr.l ap3resv
- clr.l ap4resv
- move.w #10,opcode
- clr.w sintin
- move.w #1,sintout
- clr.w saddrin
- clr.w sadrout
- bsr.l aes ;appl_init
-
- move.w #77,opcode
- clr.w sintin
- move.w #5,sintout
- clr.w saddrin
- clr.w sadrout
- bsr.l aes ;graf_handle
- move.w intout,grhand ;save the graphics handle
-
- move.w #100,opcode
- clr.w contrl+2
- move.w #11,contrl+6
- move.w grhand,contrl+12
- move.w #1,D0
- move.w D0,intin
- move.w D0,intin+2
- move.w D0,intin+4
- move.w D0,intin+6
- move.w D0,intin+8
- move.w D0,intin+10
- move.w D0,intin+12
- move.w D0,intin+14
- move.w D0,intin+16
- move.w D0,intin+18 ;faster to use D0 than #1
- move.w #2,intin+20
- bsr.l vdi ;open_vwork
-
- rscload
- move.w #110,contrl
- clr.w contrl+2
- move.w #1,contrl+4
- move.w #1,contrl+6
- clr.w contrl+8
- move.l #resrce,addrin ;address of resource filename
- bsr.l aes ;rsrc_load
- tst.w intout ;error?
- bne.s rscget ;no = get address of resource data
- rts ;yes = exit
-
- rscget
- move.w #112,contrl
- move.w #2,contrl+2
- move.w #1,contrl+4
- clr.w contrl+6
- move.w #1,contrl+8
- clr.w intin
- clr.w intin+2
- bsr.l aes ;rsrc_gaddr
-
- shocurs
- dc.w $A000 ;line_a init
- move.l 8(A0),A0 ;address of INTIN arrays
-
- clr.w 6(A0) ;INTIN(3) = mask color index
- move.w #1,8(A0) ;INTIN(4) = data color index
-
- add.l #10,A0 ;set INTIN pointer to INTIN(5)
- lea.l mouse,A1 ;data for new cursor mask + data
- move.w #16,D0 ;loop counter, 16 longs = 32 words
- show1
- move.l (A1)+,(A0)+ ;transfer bit maps to INTIN array
- dbra D0,show1
-
- dc.w $A00B ;line_a transform mouse
-
- dc.w $A000 ;line_a init
- move.l 8(A0),A1 ;get address of INTIN arrays again
-
- clr.w (A1)
- dc.w $A009 ;line_a show mouse
-
- menu
- move.w #30,contrl
- move.w #1,D0 ;faster to use D0 than #1
- move.w D0,contrl+2
- move.w D0,contrl+4
- move.w D0,contrl+6
- clr.w contrl+8
- move.w D0,intin ;me_bshow = draw the menu bar
- move.l addrout,addrin ;me_btree = address returned from rsrc_gaddr
- bsr.l aes ;menu_bar
-
- wait
- move.w #23,contrl
- clr.w contrl+2
- move.w #1,contrl+4
- move.w #1,contrl+6
- clr.w contrl+8
- move.l #buffer,addrin
- bsr.l aes ;evnt_mesag
-
- rts
-
- *-------------------------------------------------------------------------
- * data/storage
- *-------------------------------------------------------------------------
- ds.w 0
-
- aespb dc.l contrl,global,intin,intout,addrin,addrout
- vdipb dc.l contrl,intin,ptsin,intout,ptsout
- xpos dc.w 1
- ypos dc.w 1
- resrce dc.b 'MENU.RSC',00,00
-
- mouse
- mask
- dc.w %0100000000000000
- dc.w %1110000000000000
- dc.w %1111000000000000
- dc.w %1111100000000000
- dc.w %1111110000000000
- dc.w %1111111000000000
- dc.w %1111111100000000
- dc.w %1111111110000000
- dc.w %1111111111000000
- dc.w %1111111111100000
- dc.w %1111111000000000
- dc.w %1110111100000000
- dc.w %1100111100000000
- dc.w %0000011110000000
- dc.w %0000011110000000
- dc.w %0000001100000000
-
- data
- dc.w %0000000000000000
- dc.w %0100000000000000
- dc.w %0110000000000000
- dc.w %0111000000000000
- dc.w %0111100000000000
- dc.w %0111110000000000
- dc.w %0111111000000000
- dc.w %0111111100000000
- dc.w %0111111110000000
- dc.w %0111110000000000
- dc.w %0110110000000000
- dc.w %0100011000000000
- dc.w %0000011000000000
- dc.w %0000001100000000
- dc.w %0000001100000000
- dc.w %0000000000000000
-
- sbss equ * ;this is the only way to define a bss
- ;section in the GST assembler
-
- contrl equ sbss
- opcode equ contrl
- sintin equ opcode+2
- sintout equ sintin+2
- saddrin equ sintout+2
- sadrout equ saddrin+2
-
- global equ sadrout+14
- apvers equ global
- apcount equ apvers+2
- apid equ apcount+2
- appriv equ apid+2
- apptree equ appriv+4
- ap1resv equ apptree+4
- ap2resv equ ap1resv+4
- ap3resv equ ap2resv+4
- ap4resv equ ap3resv+4
-
- intin equ ap4resv+4
- ptsin equ intin+256
- intout equ ptsin+256
- ptsout equ intout+256
- addrin equ ptsout+256
- addrout equ addrin+256
-
- grhand equ addrout+256
- buffer equ grhand+2
- stack equ grhand+16+1200
- ebss equ stack+20
-
- END
-
-